/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

/**
 *
 * @author Sandro
 */
@Embeddable
public class FamiliaMateriaPrimaId implements java.io.Serializable{
    
    private Familia familia;
    private MateriaPrima materiaprima;

    @ManyToOne
    public Familia getFamilia() {
        return familia;
    }

    public void setFamilia(Familia familia) {
        this.familia = familia;
    }

    @ManyToOne
    public MateriaPrima getMateriaprima() {
        return materiaprima;
    }

    public void setMateriaprima(MateriaPrima materiaprima) {
        this.materiaprima = materiaprima;
    }
    
    public boolean equals(Object o){
        if(this == o) return true;
        if(o==null || getClass() != o.getClass()) return false;
        FamiliaMateriaPrimaId that = (FamiliaMateriaPrimaId) o;
        if(familia != null ? !familia.equals(that.familia) : that.familia != null) return false;
        if(materiaprima != null ? !materiaprima.equals(that.materiaprima) : that .materiaprima != null)
            return false;
        return true;
    }
    
    public int hashCode(){
        int result;
        result = (familia != null ? familia.hashCode() : 0);
        result = 31 * result + (materiaprima != null ? materiaprima.hashCode() : 0);
        return result;
    }
    
}
